@extends('admin.huawei')
@section('content')
    <!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            商品管理
            <small>商品列表</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 后台</a></li>
            <li><a href="#">商品管理</a></li>
            <li class="active">商品列表</li>
        </ol>
    </section>
        <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">商品列表</h3>
                    </div><!-- /.box-header -->
                    <div class="box-body">
                            <style>
                               /* th{
                                    text-align:center;
                                }
                                td{
                                    text-align:center;
                                }*/
                            </style>
                        <table id="example2" class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <th style="display:none;">商品ID</th>
                                <th>商品名称</th>
                                <th>商品参数</th>
                                <th>商品颜色</th>
                                <th>商品价格</th>
                                <th>商品余量</th>
                                <th>商品售量</th>
                                <th>商品编辑</th>
                            </tr>
                            </thead>
                            <tbody>
                                @foreach($data as $cygoods)
                                    <!-- substr_count('-',$cygoods -> path) -->
                                    <tr>
                                        <td style="display:none;">{{ $cygoods -> id }}</td>
                                        <!-- if(substr_count('-',$cygoods -> path)) -->
                                        <td>{{ $cygoods -> name }}</td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                          <td>
                                            @if($cygoods -> count ==  0 && $cygoods -> count1 == 0)
                                            <a href=" {{ url('/admin/cygoods/delete') }}/{{ $cygoods -> id}} ">删除</a>
                                            @endif
                                            </td>
                                        </tr>
                                    @foreach($dsgoods as $b)
                                        
                                        @if($b -> pid == $cygoods -> id)
                                             
                                             <tr>
                                                    <td style="display:none;">{{ $b -> id }}</td>
                                                    <td>{{ $cygoods -> name }}　　{{ $b -> name }}</td>
                                                    <td>{{ $b -> parameter }}</td>
                                                    <td>{{ $b -> color }}</td>
                                                    <td>{{ $b -> price }}</td>
                                                    <td>{{ $b -> num }}</td>
                                                    <td>{{ $b -> sold }}</td>
                                                    <td>
                                                        <a href=" {{ url('/admin/cygoods/edit') }}/{{ $b -> id}} ">编辑</a>
                                                        <a href=" {{ url('/admin/cygoods/delete') }}/{{ $b -> id}} ">删除</a>
                                                    </td>
                                            </tr>
                                        @endif
                                    @endforeach
                                @endforeach
                            </tbody>
                        </table>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</div><!-- /.content-wrapper -->
    <script>
        window.onload = function()
        {
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });


        }
    </script>
@endsection('content')
